package com.ljh.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author grung
 * @Date 2021/2/18 10:21
 * @Version 1.0
 */

@Controller
public class UserController {

    /**
     * 登录
     *
     * @param username
     * @param password
     * @return
     */
    @PostMapping("/user/login")
    public String login(String username, String password) {
        if (!username.equals("admin") || !password.equals("admin")) {
            System.out.println("用户名密码不正确，跳转到登录页");
            return "index";
        }
        System.out.println("用户名密码正确");
        return "home";
    }

    /**
     * 收藏职位
     *
     * @param jobName
     * @return
     */
    @PostMapping("/job/collect")
    @ResponseBody
    public String job_collect(String jobName) {
        System.out.println("收藏职位成功：" + jobName);
        return "job_collect success";
    }

    /**
     * 上传简历
     *
     * @param resume
     * @return
     */
    @PostMapping("/resume/upload")
    @ResponseBody
    public String resumeUpload(String resume) {
        System.out.println("上传简历成功：" + resume);
        return "resumeUpload success";
    }

    /**
     * 投递简历
     *
     * @param resume
     * @return
     */
    @PostMapping("/resume/send")
    @ResponseBody
    public String resumeSend(String resume) {
        System.out.println("投递简历成功：" + resume);
        return "resumeSend success";
    }

    @GetMapping("/index")
    public String index() {
        return "index";
    }

    @GetMapping("/home")
    public String home() {
        return "home";
    }


}
